# encoding: utf-8
# @Author: zsl
# @Time  : 2024/10/21 22:51
# @Desc : 你还可以处理列表的部分元素，在Python 中称为切片（slice）

players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[0:3])  # ['charles', 'martina', 'michael']
print(players[1:4])  # ['martina', 'michael', 'florence']
print(players[:4])  # ['charles', 'martina', 'michael', 'florence']
print(players[2:])  # ['michael', 'florence', 'eli']
# 输出名单上最后三名队员的名字
print(players[-3:])  # ['michael', 'florence', 'eli']

print("Here are the first three players on my team:")
for player in players[:3]:
    print(player.title())
